package test;

import java.io.*;
import java.util.*;
import java.sql.*;

public class PayeeFormBeans {

    public String payeename;
    public String payeeno;
    public String bankname;
    public Hashtable errors;
    public DbConnect dbc;
    public String custid;

    public boolean validate() {
        boolean bool = true;
        if (payeename.equals("")) {
            errors.put("payeename", "Please enter your first name");
            payeename = "";
            bool = false;
        }
        if (payeeno.equals("")) {
            errors.put("payeeno", "Please enter your last name");
            payeeno = "";
            bool = false;
        }





        return bool;
    }

    public String getErrorMsg(String s) {
        String errorMsg = (String) errors.get(s.trim());
        return (errorMsg == null) ? "" : errorMsg;
    }

    public PayeeFormBeans() {
        payeename = "";
        payeeno = "";
        bankname = "";
        errors = new Hashtable();
    }

    public String getPayeename() {
        return payeename;
    }

    public String getPayeeno() {
        return payeeno;
    }

    public void setPayeename(String a) {

        payeename = a;
    }

    public void setPayeeno(String b) {

        payeeno = b;
    }

    public void setSelect1(String[] item) {
        bankname = item[0];
    }

    public boolean match() {

        boolean flag = true;
        Connection con = null;

dbc=new DbConnect();


        try {

            con = dbc.getOracleConnection();
            Statement st = con.createStatement();

            st.executeUpdate("insert into onbill_payee values("+"'"+custid+"'"+"," + "'" + payeename + "'," + "'" +bankname + "'," + "'" + payeeno + "'" + ")");




            errors.put("database", "Data Do Not Match");









        } catch (Exception e) {
            e.printStackTrace();
        }

        return flag;
    }
}
